#include<stdio.h>
#include<unistd.h>

enum
{
  success = 0,
  DivError,
  unknownError,
};
int ErrorCode = success;
int Div(int x,int y)
{
  if(y == 0)
  {
    ErrorCode = DivError; 
    return -1;
  }
  else 
  {
    return x / y;
  }
}
const char* errorString(int error)
{
  switch(error)
  {
    case success:
       return "success!";
    case DivError:
      return "div zero!";
    default:
      return "unknowError!";
  }
}
int main()
{
  int result = Div(10,0);
  printf("result  = %d,message = %s\n",result,errorString(ErrorCode));
  return ErrorCode;
}
